<template>

    <div class="second_block" v-if="visible" :style="registerSuccessSize">
      <div style="text-align: center;">
        <img src="/static/logo.png" style="width: 80px;height: 75px">
      </div>
      <el-divider></el-divider>
      <div v-if="form.evaluation_process !==2">
        <br>
        <div style="font-size: 12pt;text-align: center;font-weight: bold;color: #000000;line-height: 30px;">{{script_1}}</div>
        <br><br>
        <div  v-if="form.display_comment_link_view==1 && email_show==1 && form.gift_info.length >0">
          <!--        <div style="font-size: 20px;text-align: center;font-weight: bold;color: #000000;line-height: 30px;">{{script_2}}</div>-->
          <br><br>
          <div style="text-align: center">
            <el-button type="info" style="width: 80px" plain @click="doOff" round>No</el-button>
            &nbsp;&nbsp;
            <el-button type="warning" style="width: 80px" @click="doGiftSelection" round>Next</el-button>
          </div>
        </div>
      </div>
      <div v-else>
        <br>
        <div style="font-size: 20px;text-align: center;font-weight: bold;color: #000000;line-height: 30px;">{{register_no_script_1}}</div>
      </div>


    </div>
</template>

<script>
export default {
  name: "register-success",
  props: {
    // 弹窗是否打开
    visible: Boolean,
    // 修改回显的数据
    data: Object
  },
  data() {
    return {
      // 表单数据
      form: Object.assign({}, this.data),
      // 表单验证规则
      rules: {
      },
      // 提交状态
      loading: false,
      // 是否是修改
      isUpdate: false,
      registerSuccessSize:'',
      script_1:'',
      script_2:'',
      register_no_script_1:'',
      email_show:''
    };
  },
  mounted() {
    // 根据不同路由跳转不同页面
    if (this._isMobile()) {
      this.registerSuccessSize = 'width: calc(100vw - 85px)';
    } else {
      this.registerSuccessSize = 'width: calc(100vw - 85px);margin:0 auto;width:50%';
    }
  },
  methods : {
    // 判断是否是手机端，如果是，返回true
    _isMobile() {
      let flag = navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)
      return flag
    },
    setBuyerConfig(data){
      this.script_1 = data.register_success_page_script.script_1;
      this.script_2 = data.register_success_page_script.script_2;
      this.register_no_script_1 = data.register_no_page_script.script_1;
      this.email_show = data.email_show;
    },
    setForm(form)
    {
      this.form = form;
    },
    //关闭
    doOff()
    {
      this.$emit('RegisterNoNext');
    },
    //跳转礼品页
    doGiftSelection()
    {
      this.$emit('getRegister','');
    },
  }
}
</script>

<style scoped>

</style>
